---
title: clsProvider
summary: API reference for clsProvider.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-08-21
library: SAIF.Business.View.Provider
reference_type: embedded
---

# clsProvider

`clsProvider` is the provider aggregate root, keyed by `PROVIDER_SEQ_NUM`, and is retrieved read-only through the BOF data portal (`clsBusinessBase` + `IBusinessCriteria`). It implements `iPayee` so callers in the claim/legal layer can treat a provider as a payment recipient without knowing the underlying tax-ID/address resolution rules, and it back-navigates to a `PrimaryLocation` and lazily loads its `ProviderLocations`/`TaxIDs` child collections on demand, each triggering a separate database round trip.*

## Purpose
- Resolves and exposes the payee address for a provider by preferring the address of the tax-ID record active today over the primary location's payment address ([BR-PRV-002](../../business-rules.md#br-prv-002-payee-address-resolution-order)).
- Enforces that a provider's primary tax ID is a 9-digit numeric value via the rule engine ([BR-PRV-001](../../business-rules.md#br-prv-001-primary-tax-id-must-be-a-9-digit-number)).
- Always reports its payee type as the constant `"PROV"` classification ([BR-PRV-005](../../business-rules.md#br-prv-005-payee-type-is-always-provider)).
- Deterministically selects a primary location: the one flagged primary, else the first, else none ([BR-PRV-006](../../business-rules.md#br-prv-006-primary-location-selection)).
- Is always returned read-only from its public factory methods, preventing accidental persistence attempts ([BR-PRV-004](../../business-rules.md#br-prv-004-providers-retrieved-via-factory-methods-are-read-only)).

## Context
- Namespace: `SAIF.Business.View.Provider`
- Assembly/package: `SAIF.Business.View.Provider` (embedded/project-compiled); also distributed as the NuGet package `SAIF.BOF.Business.View.Provider` per `dependencies.md`.

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `GetProvider` | `Shared Function GetProvider(dpi As IDataPortalInfo, providerID As Decimal) As clsProvider` | Retrieves a provider by its sequence number and returns it read-only (OP-01, [BR-PRV-004](../../business-rules.md#br-prv-004-providers-retrieved-via-factory-methods-are-read-only)). |
| `GetProvider` | `Shared Function GetProvider(dpi As IDataPortalInfo, primaryTaxID As String) As clsProvider` | Retrieves a provider by primary tax ID and returns it read-only (OP-01, [BR-PRV-004](../../business-rules.md#br-prv-004-providers-retrieved-via-factory-methods-are-read-only)). |
| `GetFormattedTaxID` | `Shared Function GetFormattedTaxID(dpi As IDataPortalInfo, taxID As String) As String` | Returns the display-formatted version of a tax ID for a given provider lookup. |
| `ProviderID` | `ReadOnly Property ProviderID As Decimal` | The provider's primary key (`PROVIDER_SEQ_NUM`); zero when no matching row was found. |
| `PrimaryTaxID` | `ReadOnly Property PrimaryTaxID As String` | The provider's tax ID as stored, validated as a 9-digit number by [BR-PRV-001](../../business-rules.md#br-prv-001-primary-tax-id-must-be-a-9-digit-number). |
| `FormattedPrimaryTaxID` | `ReadOnly Property FormattedPrimaryTaxID As String` | Display-formatted rendering of `PrimaryTaxID`. |
| `RegisteredName` | `ReadOnly Property RegisteredName As String` | The provider's registered business/person name from `PROVIDER`. |
| `PrimaryLocation` | `ReadOnly Property PrimaryLocation As clsProviderLocation` | The location flagged primary, or the first location, or `Nothing` when no locations exist ([BR-PRV-006](../../business-rules.md#br-prv-006-primary-location-selection)). |
| `ProviderLocations` | `ReadOnly Property ProviderLocations As clsProviderLocationCollection` | Lazily loads all locations for this provider on first access (OP-03), a separate query per access.* |
| `TaxIDs` | `ReadOnly Property TaxIDs As clsProviderTaxIDCollection` | Lazily loads the provider's tax-ID registrations on first access (OP-08).* |
| `PayeeAddress` | `ReadOnly Property PayeeAddress As clsAddress` (via `iPayee`) | Returns the effective, non-expired tax-ID address matching the primary tax ID, or falls back to the primary location's active payment address ([BR-PRV-002](../../business-rules.md#br-prv-002-payee-address-resolution-order)). |
| `PayeeID` | `ReadOnly Property PayeeID As Decimal` (via `iPayee`) | Identifier used by payee-consuming callers to correlate this provider as a payment recipient. |
| `PayeePhoneNumber` | `ReadOnly Property PayeePhoneNumber As clsPhone` (via `iPayee`) | The phone number associated with the provider for payee purposes. |
| `PayeeType` | `ReadOnly Property PayeeType As String` (via `iPayee`) | Always resolves to the literal "Provider" payee classification ([BR-PRV-005](../../business-rules.md#br-prv-005-payee-type-is-always-provider)). |
| `PayeeTypeCode` | `ReadOnly Property PayeeTypeCode As String` (via `iPayee`) | Always the literal code `"PROV"` ([BR-PRV-005](../../business-rules.md#br-prv-005-payee-type-is-always-provider)). |
| `PayeeEmailAddress` | `ReadOnly Property PayeeEmailAddress As String` (via `iPayee`) | The provider's email address exposed for payee correspondence. |
| `IsValid` | `ReadOnly Property IsValid As Boolean` (overridden from `clsBusinessBase`) | Reflects whether the rule engine's [BR-PRV-001](../../business-rules.md#br-prv-001-primary-tax-id-must-be-a-9-digit-number) check passed; not used to gate any write since none exist. |
| `IsDirty` | `ReadOnly Property IsDirty As Boolean` (overridden from `clsBusinessBase`) | Indicates in-memory field changes since load; has no effect on persistence, since no create/update SQL is defined ([BR-DATA-001](../../business-rules.md#br-data-001-no-write-operations-are-supported)). |
| `Save` | `Function Save() As clsProvider` (overridden from `clsBusinessBase`) | Calls `ApplyEdit()`/`MyBase.Save()` but cannot persist changes because no insert/update SQL exists on `Criteria` ([BR-DATA-001](../../business-rules.md#br-data-001-no-write-operations-are-supported)).* |

## Behavioral notes
- `GetProvider` drives OP-01: the criteria's `RetrieveSQL` selects from `PROVIDER` left-joined to `PROVIDER_TAX_ID` (SQL-PRV-01), and a missing row leaves `ProviderID = 0` rather than raising an error.*
- Every navigation property (`PrimaryLocation`, `ProviderLocations`, `TaxIDs`) triggers its own database query on first access — no caching occurs across properties, and the reciprocal `clsProvider.ProviderLocations` → `clsProviderLocation.Provider` navigation forms a cycle broken only by lazy-load null checks.*
- All 12 direct `IBusinessCriteria` implementations in this library — including `clsProvider`'s — throw `ApplicationException(clsConstants.Messages.InvalidSQLProperty)` from `CreateSQL`/`InsertSQL`/`UpdateSQL`/`DeleteSQL` ([BR-DATA-001](../../business-rules.md#br-data-001-no-write-operations-are-supported)).

## Constraints and usage notes
- Instances returned by `GetProvider` are marked `ReadOnly = True`; callers must not attempt to persist changes ([BR-PRV-004](../../business-rules.md#br-prv-004-providers-retrieved-via-factory-methods-are-read-only)).
- `PayeeAddress` performs an implicit tax-ID lookup and address comparison every time it is read; callers needing repeated access should cache the result themselves.*

> **Note:** Statements marked with `*` were inferred from code structure, naming
> conventions, or contextual evidence where direct confirmation was not available
> in source artifacts. Statements marked with `**` could not be confirmed; treat
> as unknown until verified.

## Sources
- SAIF.Business.View.Provider/clsProvider.vb
